//
//  File.swift
//  
//
//  Created by ellzu gu on 2021/9/2.
//

import Foundation

public class PathRequest {
    public let path: String
    public init(_ path: String) {
        self.path = path
    }
}

extension PathRequest {
    public static func request(_ parameter: [String : Any]) -> Result<PathRequest, DispatchError> {
//        let result: Result<String, Error> = .success("")
//        if case let .success(r) = result {
//            let b = r
//        }
//
        guard let path = parameter["path"] as? String else {
            return .failure(DispatchError(.ParameterError, message: "path not a string"))
        }
        return .success(PathRequest(path))
    }
}
